<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.5"/>
<title>xilsecure: xsecure.c File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="HTML_custom.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="xlogo_bg.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">xilsecure
   </div>
   <div id="projectbrief">Vitis Drivers API Documentation</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.5 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Overview</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li><a href="globals.html"><span>APIs</span></a></li>
      <li><a href="files.html"><span>File&#160;List</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;"
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('xsecure_8c.html','');});
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">xsecure.c File Reference</div>  </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">Overview</h2>
<div class="textblock"><p>This file contains the implementation of the interface functions for secure library. </p>
<pre>
MODIFICATION HISTORY:</pre><pre>Ver   Who Date     Changes
----- --- -------- -------------------------------------------------------
1.0   DP  02/15/17 Initial release
2.2   vns 09/18/17 Added APIs to support generic functionality
                   for SHA3 and RSA hardware at linux level.
                   Removed RSA-SHA2 authentication support
                   for loading linux image and dtb from u-boot, as here it
                   is using SHA2 hash and single RSA key pair authentication
3.0   vns 02/21/18 Added support for single partition image authentication
                   and/or decryption.
3.1   vns 04/13/18 Added device key support even if authentication is not
                   been enabled for single partition image, when PMUFW is
                   compiled by enabling secure environment variable in bsp
                   settings.
      ka  04/10/18 Added support for user-efuse revocation
      ka  04/18/18 Added support for Zeroization of the memory in case of
                   Gcm-Tag mismatch
3.2   ka  04/04/18 Added support for Sha3_Update, if the payload is not
             4 bytes aligned.
      ka  08/03/18 Added XSecure_Aes Api's to encrypt or decrypt data-blobs.
      ka  10/25/18 Added support to clear user key after use.
4.0   arc 18/12/18 Fixed MISRA-C violations.
      arc 12/02/19 Added support for validate image format.
      rama 18/03/19 Fixed IAR compiler errors and warnings
      arc 03/20/19 Reading the return value of the functions to validate
4.0  Nava 19/03/19 In the current implementation, the SecureIv variable
                   is sharing between xilfpga and Xilsecure libraries.
                   To avoid data sharing conflicts removed SecureIV
                   shared variable dependency.
      mmd 03/15/19 Refactored the code
      psl 03/26/19 Fixed MISRA-C violation
4.1   psl 07/02/19 Fixed Coverity warning.
      mmd 07/05/19 Optimized the code
      psl 07/31/19 Fixed MISRA-C violations.
4.2   kal 03/12/20 Authenticate SizeofImgHdr before use, in case of failure
                   return XSECURE_IMAGE_HEADER_SIZE_ERR.
                   Added support to hold Aes engine in reset after secure
                   image processing.
      vns 03/24/20 Cleared locally copied user key
                   Corrected IV calculation
      ana 04/03/20 Removed the support of storing key in global array
      rpo 04/09/20 Aligned the buffers used by DMA to 64 bytes
      kpt 04/10/20 Resolved coverity warnings
      ana 04/24/20 Removed support of boot header RSA with 0x1 and 0x2
4.6   am  09/17/21 Resolved compiler warnings
4.7   am  11/26/21 Resolved doxygen warnings
      har 01/03/22 Updated Status as XSECURE_SHA3_INIT_FAIL in case of failure
                   in <a class="el" href="group__xsecure__sha__client__apis.html#gabf91e298c2be913258c6a4b23660a528" title="This function stores the Sha3 initialize state as initialized if the current state is uninitialized...">XSecure_Sha3Initialize()</a>
5.2   ng  07/05/23 add SDT support</pre><pre></pre><dl class="section note"><dt>Note</dt><dd></dd></dl>
</div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a4fd45abb6cdf3c35aa46792bf312dbed"><td class="memItemLeft" align="right" valign="top">u32&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xsecure_8c.html#a4fd45abb6cdf3c35aa46792bf312dbed">XSecure_CsuDmaInit</a> (void)</td></tr>
<tr class="memdesc:a4fd45abb6cdf3c35aa46792bf312dbed"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function is used to initialize the DMA driver.  <a href="#a4fd45abb6cdf3c35aa46792bf312dbed">More...</a><br/></td></tr>
<tr class="separator:a4fd45abb6cdf3c35aa46792bf312dbed"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7200f6237c09024ed15ce77d1f7f262f"><td class="memItemLeft" align="right" valign="top">XCsuDma *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xsecure_8c.html#a7200f6237c09024ed15ce77d1f7f262f">Xsecure_GetCsuDma</a> (void)</td></tr>
<tr class="memdesc:a7200f6237c09024ed15ce77d1f7f262f"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function is used to initialize CsuDma and return CsuDma pointer.  <a href="#a7200f6237c09024ed15ce77d1f7f262f">More...</a><br/></td></tr>
<tr class="separator:a7200f6237c09024ed15ce77d1f7f262f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:adfb02b0d0129acbfe8a8d6a293a7285f"><td class="memItemLeft" align="right" valign="top">u32&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xsecure_8c.html#adfb02b0d0129acbfe8a8d6a293a7285f">XSecure_Sha3Hash</a> (u32 SrcAddrHigh, u32 SrcAddrLow, u32 SrcSize, u32 Flags)</td></tr>
<tr class="memdesc:adfb02b0d0129acbfe8a8d6a293a7285f"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function access the xilsecure SHA3 hardware based on the flags provided to calculate the SHA3 hash.  <a href="#adfb02b0d0129acbfe8a8d6a293a7285f">More...</a><br/></td></tr>
<tr class="separator:adfb02b0d0129acbfe8a8d6a293a7285f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a55d3f721f0d915165ee23ead0d021857"><td class="memItemLeft" align="right" valign="top">u32&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xsecure_8c.html#a55d3f721f0d915165ee23ead0d021857">XSecure_RsaCore</a> (u32 SrcAddrHigh, u32 SrcAddrLow, u32 SrcSize, u32 Flags)</td></tr>
<tr class="memdesc:a55d3f721f0d915165ee23ead0d021857"><td class="mdescLeft">&#160;</td><td class="mdescRight">This is the function to RSA decrypt or encrypt the provided data and load back to memory.  <a href="#a55d3f721f0d915165ee23ead0d021857">More...</a><br/></td></tr>
<tr class="separator:a55d3f721f0d915165ee23ead0d021857"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aed078cea869af70d50468b7ca38dcd32"><td class="memItemLeft" align="right" valign="top">u32&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xsecure_8c.html#aed078cea869af70d50468b7ca38dcd32">XSecure_AesOperation</a> (u32 AddrHigh, u32 AddrLow)</td></tr>
<tr class="memdesc:aed078cea869af70d50468b7ca38dcd32"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function checks for flags field of the XSecure_AesParams struct and resolves weather the request is encryption or decryption.  <a href="#aed078cea869af70d50468b7ca38dcd32">More...</a><br/></td></tr>
<tr class="separator:aed078cea869af70d50468b7ca38dcd32"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a17ffcc1179ee379019196d122403f8dc"><td class="memItemLeft" align="right" valign="top">u32&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xsecure_8c.html#a17ffcc1179ee379019196d122403f8dc">XSecure_DataAuth</a> (u8 *Signature, <a class="el" href="struct_x_secure___rsa_key.html">XSecure_RsaKey</a> *KeyInst, u8 *Hash)</td></tr>
<tr class="memdesc:a17ffcc1179ee379019196d122403f8dc"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function performs authentication of data by encrypting the signature with provided key and compares with hash of the data and returns success or failure.  <a href="#a17ffcc1179ee379019196d122403f8dc">More...</a><br/></td></tr>
<tr class="separator:a17ffcc1179ee379019196d122403f8dc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a54a754b03bfbbe9c42f9f3d10959f04e"><td class="memItemLeft" align="right" valign="top">u32&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xsecure_8c.html#a54a754b03bfbbe9c42f9f3d10959f04e">XSecure_PartitionAuthentication</a> (XCsuDma *CsuDmaInstPtr, u8 *Data, u32 Size, u8 *AuthCertPtr)</td></tr>
<tr class="memdesc:a54a754b03bfbbe9c42f9f3d10959f04e"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function performs authentication of a partition of an image.  <a href="#a54a754b03bfbbe9c42f9f3d10959f04e">More...</a><br/></td></tr>
<tr class="separator:a54a754b03bfbbe9c42f9f3d10959f04e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a13ca99347b37b300de1c90e694fd116b"><td class="memItemLeft" align="right" valign="top">u32&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xsecure_8c.html#a13ca99347b37b300de1c90e694fd116b">XSecure_MemCopy</a> (void *DestPtr, void *SrcPtr, u32 Size)</td></tr>
<tr class="memdesc:a13ca99347b37b300de1c90e694fd116b"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function copies the data from specified source to destination using CSU DMA.  <a href="#a13ca99347b37b300de1c90e694fd116b">More...</a><br/></td></tr>
<tr class="separator:a13ca99347b37b300de1c90e694fd116b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a65d3059c55b42f10354592056c053610"><td class="memItemLeft" align="right" valign="top">u32&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xsecure_8c.html#a65d3059c55b42f10354592056c053610">XSecure_VerifySpk</a> (u8 *AcPtr, u32 EfuseRsaenable)</td></tr>
<tr class="memdesc:a65d3059c55b42f10354592056c053610"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function verifies SPK by authenticating SPK with PPK, also checks either SPK is revoked or not.if it is not boot header authentication.  <a href="#a65d3059c55b42f10354592056c053610">More...</a><br/></td></tr>
<tr class="separator:a65d3059c55b42f10354592056c053610"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8edc4da56d93ab6df2072aa149d79344"><td class="memItemLeft" align="right" valign="top">u32&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xsecure_8c.html#a8edc4da56d93ab6df2072aa149d79344">XSecure_AuthenticationHeaders</a> (u8 *StartAddr, XSecure_ImageInfo *ImageInfo)</td></tr>
<tr class="memdesc:a8edc4da56d93ab6df2072aa149d79344"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function authenticates the single partition image's boot header and image header, also copies all the required details to the ImageInfo pointer.  <a href="#a8edc4da56d93ab6df2072aa149d79344">More...</a><br/></td></tr>
<tr class="separator:a8edc4da56d93ab6df2072aa149d79344"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8cf65db24d617af02144836f17aaacab"><td class="memItemLeft" align="right" valign="top">u32&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xsecure_8c.html#a8cf65db24d617af02144836f17aaacab">XSecure_SecureImage</a> (u32 AddrHigh, u32 AddrLow, u32 KupAddrHigh, u32 KupAddrLow, XSecure_DataAddr *Addr)</td></tr>
<tr class="memdesc:a8cf65db24d617af02144836f17aaacab"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function process the secure image of single partition created by bootgen.  <a href="#a8cf65db24d617af02144836f17aaacab">More...</a><br/></td></tr>
<tr class="separator:a8cf65db24d617af02144836f17aaacab"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af673d8443678e45f3334378a4b446881"><td class="memItemLeft" align="right" valign="top">u32&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xsecure_8c.html#af673d8443678e45f3334378a4b446881">XSecure_IsRsaEnabled</a> (void)</td></tr>
<tr class="memdesc:af673d8443678e45f3334378a4b446881"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function tells whether RSA authentication is enabled or not.  <a href="#af673d8443678e45f3334378a4b446881">More...</a><br/></td></tr>
<tr class="separator:af673d8443678e45f3334378a4b446881"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a23dad33b2fa4200a33342e8353b7b73f"><td class="memItemLeft" align="right" valign="top">u32&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xsecure_8c.html#a23dad33b2fa4200a33342e8353b7b73f">XSecure_IsEncOnlyEnabled</a> (void)</td></tr>
<tr class="memdesc:a23dad33b2fa4200a33342e8353b7b73f"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function tells whether encrypt only is enabled or not.  <a href="#a23dad33b2fa4200a33342e8353b7b73f">More...</a><br/></td></tr>
<tr class="separator:a23dad33b2fa4200a33342e8353b7b73f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6c51d7aa8a0db0c40a00a641d7aa4055"><td class="memItemLeft" align="right" valign="top">u32&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xsecure_8c.html#a6c51d7aa8a0db0c40a00a641d7aa4055">XSecure_PpkVerify</a> (XCsuDma *CsuDmaInstPtr, u8 *AuthCert)</td></tr>
<tr class="memdesc:a6c51d7aa8a0db0c40a00a641d7aa4055"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function verifies the PPK hash with PPK programmed on efuse.  <a href="#a6c51d7aa8a0db0c40a00a641d7aa4055">More...</a><br/></td></tr>
<tr class="separator:a6c51d7aa8a0db0c40a00a641d7aa4055"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae9ccb5dc051bf792ce88b8f3fe376122"><td class="memItemLeft" align="right" valign="top">u32&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xsecure_8c.html#ae9ccb5dc051bf792ce88b8f3fe376122">XSecure_SpkAuthentication</a> (XCsuDma *CsuDmaInstPtr, u8 *AuthCert, u8 *Ppk)</td></tr>
<tr class="memdesc:ae9ccb5dc051bf792ce88b8f3fe376122"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function authenticates SPK with provided PPK or PPK from authentication certificate.  <a href="#ae9ccb5dc051bf792ce88b8f3fe376122">More...</a><br/></td></tr>
<tr class="separator:ae9ccb5dc051bf792ce88b8f3fe376122"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a39d709813a6f7eb25f5ecd0871d05615"><td class="memItemLeft" align="right" valign="top">u32&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xsecure_8c.html#a39d709813a6f7eb25f5ecd0871d05615">XSecure_SpkRevokeCheck</a> (u8 *AuthCert)</td></tr>
<tr class="memdesc:a39d709813a6f7eb25f5ecd0871d05615"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function checks whether SPK is been revoked or not.  <a href="#a39d709813a6f7eb25f5ecd0871d05615">More...</a><br/></td></tr>
<tr class="separator:a39d709813a6f7eb25f5ecd0871d05615"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="aed078cea869af70d50468b7ca38dcd32"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">u32 XSecure_AesOperation </td>
          <td>(</td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>AddrHigh</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>AddrLow</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function checks for flags field of the XSecure_AesParams struct and resolves weather the request is encryption or decryption. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">AddrHigh</td><td>Higher 32 bit address of the XSecure_AesParams structure. </td></tr>
    <tr><td class="paramname">AddrLow</td><td>Lower 32 bit address of the XSecure_AesParams structure.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Returns Status<ul>
<li>XST_SUCCESS on success</li>
<li>Error code on failure </li>
</ul>
</dd></dl>

<p>References <a class="el" href="xsecure_8h.html#ac1d450a8bf29adb33a6855a2d495d00e">XSECURE_AES_KUP_KEY</a>, <a class="el" href="xsecure_8h.html#a6464d20441b964ce323ad22682aca0e0">XSECURE_DEC</a>, <a class="el" href="xsecure_8h.html#a8fc327ff9798f63989b9d3bd4e0eee6f">XSECURE_DEC_WRONG_KEY_SOURCE</a>, <a class="el" href="xsecure_8h.html#aa4958a083577e645ef5b378ee50b3619">XSECURE_ENC</a>, <a class="el" href="xsecure_8h.html#aa03f86ffde3ba23e16caebaa5d79505f">XSECURE_INVALID_FLAG</a>, <a class="el" href="xsecure_8h.html#a9cfe718a7b68413d0ca760cf435f85aa">XSECURE_SIZE_ERR</a>, and <a class="el" href="group__xsecure__common__apis.html#ga09ac633955bf536ddd22f13805791a2e">XSECURE_WORD_LEN</a>.</p>

</div>
</div>
<a class="anchor" id="a8edc4da56d93ab6df2072aa149d79344"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">u32 XSecure_AuthenticationHeaders </td>
          <td>(</td>
          <td class="paramtype">u8 *&#160;</td>
          <td class="paramname"><em>StartAddr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">XSecure_ImageInfo *&#160;</td>
          <td class="paramname"><em>ImageInfo</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function authenticates the single partition image's boot header and image header, also copies all the required details to the ImageInfo pointer. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">StartAddr</td><td>Pointer to the single partition image. </td></tr>
    <tr><td class="paramname">ImageInfo</td><td>Pointer to XSecure_ImageInfo structure.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Returns Status<ul>
<li>XST_SUCCESS on success</li>
<li>Error code on failure</li>
</ul>
</dd></dl>
<ul>
<li>XSECURE_AUTH_NOT_ENABLED - represents image is not authenticated.</li>
</ul>
<dl class="section note"><dt>Note</dt><dd>Copies the header and authentication certificate to internal buffer. </dd></dl>

<p>References <a class="el" href="struct_x_secure___partition_header.html#a18fbeea3fb57286dcc783c794fa16d00">XSecure_PartitionHeader::NextPartitionOffset</a>, <a class="el" href="xsecure_8h.html#a8b2e806f4902d54a578031a7ed7f5fa7">XSECURE_AC_IMAGE_HDR_OFFSET</a>, <a class="el" href="xsecure_8h.html#a18ebdf06fcc70af20626ef1cf374555c">XSECURE_ARRAY_LENGTH</a>, <a class="el" href="xsecure_8h.html#aa68197df399a72a69c10f58cb3a3de79">XSECURE_AUTH_CERT_MIN_SIZE</a>, <a class="el" href="xsecure_8h.html#ac22af04a8738c4ab4788cea5ef027cf2">XSECURE_AUTH_ISCOMPULSORY</a>, <a class="el" href="xsecure_8h.html#ad49a6c04f8c5d2f0323c471c54170614">XSECURE_AUTH_NOT_ENABLED</a>, <a class="el" href="xsecure_8h.html#a73968ccc94e85778c1f6e65b5d0ea53e">XSECURE_BOOT_HDR_MAX_SIZE</a>, <a class="el" href="xsecure_8h.html#aac2297f42fbafe37616330961ab4c36a">XSECURE_BUFFER_SIZE</a>, <a class="el" href="xsecure_8h.html#a8fc327ff9798f63989b9d3bd4e0eee6f">XSECURE_DEC_WRONG_KEY_SOURCE</a>, <a class="el" href="xsecure_8h.html#a1c99be6a6b095d43fcf926f491c10048">XSECURE_ENC_ISCOMPULSORY</a>, <a class="el" href="xsecure_8h.html#a3de6a24abf352822aa013dcd4e79f5f7">XSECURE_IMAGE_HDR_OFFSET</a>, <a class="el" href="xsecure_8h.html#aee6b3aacc8ea38327f3c356238a26b7d">XSECURE_IMAGE_HEADER_SIZE_ERR</a>, <a class="el" href="xsecure_8h.html#aa00aff8929412559a84c6ea92f68de9c">XSECURE_IMAGE_SYNC_WORD_OFFSET</a>, <a class="el" href="xsecure_8h.html#ab04b134d7a0aa7161c4b31463abbbfd3">XSECURE_IMAGE_WITH_MUL_PARTITIONS</a>, <a class="el" href="xsecure_8h.html#afa3ce807e93147987f4244513bf9a3ed">XSECURE_IMG_HDR_FAIL</a>, <a class="el" href="xsecure_8h.html#a4d01ab07664196d441d79fbc24e4c8ec">XSECURE_INVALID_IMAGE_ERROR</a>, <a class="el" href="xsecure_8c.html#a23dad33b2fa4200a33342e8353b7b73f">XSecure_IsEncOnlyEnabled()</a>, <a class="el" href="xsecure_8c.html#af673d8443678e45f3334378a4b446881">XSecure_IsRsaEnabled()</a>, <a class="el" href="xsecure_8h.html#ad18affbc479b51e1a7de3221187f2297">XSECURE_IV_LEN</a>, <a class="el" href="xsecure_8h.html#a66458ce27949f2f92e6f622d6303221c">XSECURE_IV_OFFSET</a>, <a class="el" href="xsecure_8h.html#a9c8ada760210d274cef925099e1d6f6b">XSECURE_KEY_SOURCE_OFFSET</a>, <a class="el" href="xsecure_8h.html#a8c08e67e8de455fa33137880aac4c942">XSECURE_KEY_SRC_BBRAM</a>, <a class="el" href="xsecure_8h.html#a380a712ef28e82d96df301ebe45b2415">XSECURE_KEY_SRC_BLACK_BH</a>, <a class="el" href="xsecure_8h.html#a4ca380bbff8982b378c132fa8dee709d">XSECURE_KEY_SRC_GREY_BH</a>, <a class="el" href="xsecure_8c.html#a13ca99347b37b300de1c90e694fd116b">XSecure_MemCopy()</a>, <a class="el" href="xsecure_8c.html#a54a754b03bfbbe9c42f9f3d10959f04e">XSecure_PartitionAuthentication()</a>, <a class="el" href="xsecure_8h.html#ab76efd768465162bf06332794e75fe8f">XSECURE_PH_ATTR_ENC_ENABLE</a>, <a class="el" href="xsecure_8h.html#a94c8b9c73cb71a12aaf41e1a4a365f82">XSECURE_PH_IV_MASK</a>, <a class="el" href="xsecure_8h.html#ad5b0743d403b2eead86eec08ecc1191e">XSECURE_PH_OFFSET</a>, <a class="el" href="xsecure_8h.html#ae91268580ada98ce004dd804a53043a3">XSECURE_PH_TABLE_OFFSET</a>, and <a class="el" href="group__xsecure__common__apis.html#ga09ac633955bf536ddd22f13805791a2e">XSECURE_WORD_LEN</a>.</p>

<p>Referenced by <a class="el" href="xsecure_8h.html#a8cf65db24d617af02144836f17aaacab">XSecure_SecureImage()</a>.</p>

</div>
</div>
<a class="anchor" id="a4fd45abb6cdf3c35aa46792bf312dbed"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">u32 XSecure_CsuDmaInit </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function is used to initialize the DMA driver. </p>
<dl class="section return"><dt>Returns</dt><dd>returns the error code on any error returns XST_SUCCESS on success </dd></dl>

<p>References <a class="el" href="xsecure_8h.html#a6769724551598baf7c12aa0ff8e49647">XSECURE_CSUDMA_DEVICEID</a>, and <a class="el" href="xsecure_8h.html#a46aedd95d7c6d65e8988a644e44321d1">XSECURE_ERROR_CSUDMA_INIT_FAIL</a>.</p>

<p>Referenced by <a class="el" href="xsecure_8h.html#a7200f6237c09024ed15ce77d1f7f262f">Xsecure_GetCsuDma()</a>, <a class="el" href="xsecure_8h.html#a8cf65db24d617af02144836f17aaacab">XSecure_SecureImage()</a>, and <a class="el" href="xsecure_8h.html#adfb02b0d0129acbfe8a8d6a293a7285f">XSecure_Sha3Hash()</a>.</p>

</div>
</div>
<a class="anchor" id="a17ffcc1179ee379019196d122403f8dc"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">u32 XSecure_DataAuth </td>
          <td>(</td>
          <td class="paramtype">u8 *&#160;</td>
          <td class="paramname"><em>Signature</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="struct_x_secure___rsa_key.html">XSecure_RsaKey</a> *&#160;</td>
          <td class="paramname"><em>KeyInst</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u8 *&#160;</td>
          <td class="paramname"><em>Hash</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function performs authentication of data by encrypting the signature with provided key and compares with hash of the data and returns success or failure. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">Signature</td><td>Pointer to the RSA signature of the data </td></tr>
    <tr><td class="paramname">KeyInst</td><td>Pointer to <a class="el" href="struct_x_secure___rsa_key.html" title="Input parameters pointers for RSA. ">XSecure_RsaKey</a> structure. </td></tr>
    <tr><td class="paramname">Hash</td><td>Pointer to the hash of the data to be authenticated.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Returns Status<ul>
<li>XST_SUCCESS on success</li>
<li>Error code on failure </li>
</ul>
</dd></dl>

<p>References <a class="el" href="struct_x_secure___rsa_key.html#ac7ccbaa661b815e4e58fbbb8fe9e7d1e">XSecure_RsaKey::Exponent</a>, <a class="el" href="struct_x_secure___rsa_key.html#ac1d53c62a658dc10167d960e2294ee57">XSecure_RsaKey::Exponentiation</a>, <a class="el" href="struct_x_secure___rsa_key.html#aed040e601a44dabe9ba442b5dcb2fccb">XSecure_RsaKey::Modulus</a>, <a class="el" href="xsecure_8h.html#ae83d91a9973bc48dc5057ad4e02ac3ce">XSECURE_AUTH_FAILURE</a>, <a class="el" href="group__xsecure__rsa__server__apis.html#gae3637356df5720621bbd9924fa45a8d8">XSECURE_HASH_TYPE_SHA3</a>, <a class="el" href="xsecure_8h.html#a74c332e6926eb08c531fa4558c52ae2c">XSECURE_MOD_LEN</a>, <a class="el" href="xsecure_8h.html#a9595b282fd35df1381678970068884b6">XSECURE_RSA_ENCRYPT_ERR</a>, <a class="el" href="xsecure_8h.html#aaf585eb3f73504822eebdad3cf3e2d52">XSECURE_RSA_INIT_ERR</a>, <a class="el" href="group__xsecure__rsa__server__apis.html#ga097e8ed2f4933286ea5ef93210572b6b">XSecure_RsaInitialize()</a>, <a class="el" href="group__xsecure__rsa__client__apis.html#gaf2a6250efae11b0bdbfe22e6642dedf4">XSecure_RsaPublicEncrypt()</a>, <a class="el" href="group__xsecure__rsa__client__apis.html#ga8bdc7108615c89806dae54dd56f428d7">XSecure_RsaSignVerification()</a>, and <a class="el" href="xsecure_8h.html#a06fd479d4a9d395e469decc2a6158ce2">XSECURE_VERIFY_ERR</a>.</p>

</div>
</div>
<a class="anchor" id="a7200f6237c09024ed15ce77d1f7f262f"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">XCsuDma* Xsecure_GetCsuDma </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function is used to initialize CsuDma and return CsuDma pointer. </p>
<dl class="section return"><dt>Returns</dt><dd>returns reference to a XCsuDma driver instance </dd></dl>

<p>References <a class="el" href="xsecure_8c.html#a4fd45abb6cdf3c35aa46792bf312dbed">XSecure_CsuDmaInit()</a>.</p>

</div>
</div>
<a class="anchor" id="a23dad33b2fa4200a33342e8353b7b73f"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">u32 XSecure_IsEncOnlyEnabled </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function tells whether encrypt only is enabled or not. </p>
<dl class="section return"><dt>Returns</dt><dd>Returns Status<ul>
<li>XSECURE_ENABLED if enc_only bit of efuse is programmed</li>
<li>XSECURE_NOTENABLED if enc_only bit of efuse is not programmed </li>
</ul>
</dd></dl>

<p>References <a class="el" href="xsecure_8h.html#ae33786149ea4cbc8eaebd03b1668ab4b">XSECURE_EFUSE_SEC_CTRL</a>, <a class="el" href="xsecure_8h.html#a798543c1c91fefc28a32091a0e202d2c">XSECURE_ENABLED</a>, and <a class="el" href="xsecure_8h.html#a7002dfecea948fa3707b00a942b7ce62">XSECURE_NOTENABLED</a>.</p>

<p>Referenced by <a class="el" href="xsecure_8h.html#a8edc4da56d93ab6df2072aa149d79344">XSecure_AuthenticationHeaders()</a>, and <a class="el" href="xsecure_8h.html#a8cf65db24d617af02144836f17aaacab">XSecure_SecureImage()</a>.</p>

</div>
</div>
<a class="anchor" id="af673d8443678e45f3334378a4b446881"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">u32 XSecure_IsRsaEnabled </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function tells whether RSA authentication is enabled or not. </p>
<dl class="section return"><dt>Returns</dt><dd>Returns Status<ul>
<li>XSECURE_ENABLED if RSA bit of efuse is programmed</li>
<li>XSECURE_NOTENABLED if RSA bit of efuse is not programmed. </li>
</ul>
</dd></dl>

<p>References <a class="el" href="xsecure_8h.html#ae33786149ea4cbc8eaebd03b1668ab4b">XSECURE_EFUSE_SEC_CTRL</a>, <a class="el" href="xsecure_8h.html#a798543c1c91fefc28a32091a0e202d2c">XSECURE_ENABLED</a>, and <a class="el" href="xsecure_8h.html#a7002dfecea948fa3707b00a942b7ce62">XSECURE_NOTENABLED</a>.</p>

<p>Referenced by <a class="el" href="xsecure_8h.html#a8edc4da56d93ab6df2072aa149d79344">XSecure_AuthenticationHeaders()</a>, and <a class="el" href="xsecure_8h.html#a65d3059c55b42f10354592056c053610">XSecure_VerifySpk()</a>.</p>

</div>
</div>
<a class="anchor" id="a13ca99347b37b300de1c90e694fd116b"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">u32 XSecure_MemCopy </td>
          <td>(</td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>DestPtr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>SrcPtr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>Size</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function copies the data from specified source to destination using CSU DMA. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">DestPtr</td><td>Pointer to the destination address. </td></tr>
    <tr><td class="paramname">SrcPtr</td><td>Pointer to the source address. </td></tr>
    <tr><td class="paramname">Size</td><td>Data size to be copied.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Returns Status<ul>
<li>XST_SUCCESS on success</li>
<li>XST_FAILURE on failure </li>
</ul>
</dd></dl>

<p>Referenced by <a class="el" href="xsecure_8h.html#a8edc4da56d93ab6df2072aa149d79344">XSecure_AuthenticationHeaders()</a>, and <a class="el" href="xsecure_8h.html#a8cf65db24d617af02144836f17aaacab">XSecure_SecureImage()</a>.</p>

</div>
</div>
<a class="anchor" id="a54a754b03bfbbe9c42f9f3d10959f04e"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">u32 XSecure_PartitionAuthentication </td>
          <td>(</td>
          <td class="paramtype">XCsuDma *&#160;</td>
          <td class="paramname"><em>CsuDmaInstPtr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u8 *&#160;</td>
          <td class="paramname"><em>Data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>Size</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u8 *&#160;</td>
          <td class="paramname"><em>AuthCertPtr</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function performs authentication of a partition of an image. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">CsuDmaInstPtr</td><td>Pointer to the CSU DMA instance. </td></tr>
    <tr><td class="paramname">Data</td><td>Pointer to partition to be authenticated. </td></tr>
    <tr><td class="paramname">Size</td><td>Represents the size of the partition. </td></tr>
    <tr><td class="paramname">AuthCertPtr</td><td>Pointer to authentication certificate of the partition.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Returns Status<ul>
<li>XST_SUCCESS on success</li>
<li>Error code on failure </li>
</ul>
</dd></dl>

<p>References <a class="el" href="xsecure_8h.html#a20f8697858a0308d60f615bfd41b4dab">XSECURE_AUTH_CERT_PARTSIG_OFFSET</a>, and <a class="el" href="xsecure_8h.html#ae83d91a9973bc48dc5057ad4e02ac3ce">XSECURE_AUTH_FAILURE</a>.</p>

<p>Referenced by <a class="el" href="xsecure_8h.html#a8edc4da56d93ab6df2072aa149d79344">XSecure_AuthenticationHeaders()</a>, and <a class="el" href="xsecure_8h.html#a8cf65db24d617af02144836f17aaacab">XSecure_SecureImage()</a>.</p>

</div>
</div>
<a class="anchor" id="a6c51d7aa8a0db0c40a00a641d7aa4055"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">u32 XSecure_PpkVerify </td>
          <td>(</td>
          <td class="paramtype">XCsuDma *&#160;</td>
          <td class="paramname"><em>CsuDmaInstPtr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u8 *&#160;</td>
          <td class="paramname"><em>AuthCert</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function verifies the PPK hash with PPK programmed on efuse. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">CsuDmaInstPtr</td><td>Pointer to CSU DMA instance. </td></tr>
    <tr><td class="paramname">AuthCert</td><td>Pointer to authentication certificate.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Returns Status<ul>
<li>XST_SUCCESS on successful verification.</li>
<li>Error code on failure. </li>
</ul>
</dd></dl>

<p>References <a class="el" href="xsecure_8h.html#aebe7876138a617993a9bc775d2d19bbd">XSECURE_AC_PPK_OFFSET</a>, <a class="el" href="xsecure_8h.html#aaad66b3a9a22b37758029025f965350c">XSECURE_AH_ATTR_PPK_SEL_MASK</a>, <a class="el" href="xsecure_8h.html#a17fc830747392352dd80bae2f57abd00">XSECURE_AH_ATTR_PPK_SEL_SHIFT</a>, <a class="el" href="xsecure_8h.html#aa352d0f4d8bfbeb8cb1d677a6128d0a3">XSECURE_EFUSE_PPK0</a>, <a class="el" href="xsecure_8h.html#a9f7b03666b3801d5435c98330d19f9a2">XSECURE_EFUSE_PPK1</a>, <a class="el" href="xsecure_8h.html#ae33786149ea4cbc8eaebd03b1668ab4b">XSECURE_EFUSE_SEC_CTRL</a>, <a class="el" href="group__xsecure__rsa__server__apis.html#gae3637356df5720621bbd9924fa45a8d8">XSECURE_HASH_TYPE_SHA3</a>, <a class="el" href="xsecure_8h.html#ac93fe32974d3c2dde52190edb3fb7f83">XSECURE_KEY_SIZE</a>, <a class="el" href="xsecure_8h.html#ae33bea1761946f0383cd7aeac25793fc">XSECURE_PPK_ERR</a>, <a class="el" href="xsecure_8h.html#a6c3477ad221eecc12c2a5c185c6ebf85">XSECURE_REVOKE_ERR</a>, <a class="el" href="xsecure_8h.html#a68dc4490aa35598497914d2bd4fab490">XSECURE_SEL_ERR</a>, <a class="el" href="xsecure_8h.html#a3d0210f9d8d77369512f525b74c7fb3e">XSECURE_SHA3_INIT_FAIL</a>, <a class="el" href="xsecure_8h.html#a8187245a7d4bc0641b0adfc6d432b3fd">XSECURE_SHA3_PADSELECT_ERR</a>, <a class="el" href="group__xsecure__sha__client__apis.html#ga08e726488222ad0ba91e822d90e97e1e">XSecure_Sha3Digest()</a>, <a class="el" href="group__xsecure__sha__client__apis.html#gabf91e298c2be913258c6a4b23660a528">XSecure_Sha3Initialize()</a>, <a class="el" href="group__xsecure__sha3__zynqmp__apis.html#ga2e99ff8e049c773e83e4568f73cc92c1">XSecure_Sha3PadSelection()</a>, <a class="el" href="xsecure_8h.html#a06fd479d4a9d395e469decc2a6158ce2">XSECURE_VERIFY_ERR</a>, and <a class="el" href="group__xsecure__common__apis.html#ga09ac633955bf536ddd22f13805791a2e">XSECURE_WORD_LEN</a>.</p>

</div>
</div>
<a class="anchor" id="a55d3f721f0d915165ee23ead0d021857"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">u32 XSecure_RsaCore </td>
          <td>(</td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>SrcAddrHigh</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>SrcAddrLow</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>SrcSize</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>Flags</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This is the function to RSA decrypt or encrypt the provided data and load back to memory. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">SrcAddrHigh</td><td>Higher 32-bit Linear memory space from where CSUDMA will read the data </td></tr>
    <tr><td class="paramname">SrcAddrLow</td><td>Lower 32-bit Linear memory space from where CSUDMA will read the data </td></tr>
    <tr><td class="paramname">SrcSize</td><td>Number of bytes to be encrypted or decrypted. </td></tr>
    <tr><td class="paramname">Flags,:</td><td>BIT(0) - Encryption/Decryption 0 - Rsa Private key Decryption 1 - Rsa Public key Encryption</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Returns Status XST_SUCCESS on success and error code on failure.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>Data to be encrypted/Decrypted + Modulus + Exponent Modulus and Data should always be key size Exponent : private key's exponent is key size while decrypting the signature and 32 bit for public key for encrypting the signature In this API we are not taking exponentiation value. </dd></dl>

<p>References <a class="el" href="xsecure_8h.html#a6464d20441b964ce323ad22682aca0e0">XSECURE_DEC</a>, <a class="el" href="xsecure_8h.html#a928909cd18eb56fe654098048e4a49b8">XSECURE_RSA_CORE_OPERATION</a>, <a class="el" href="group__xsecure__rsa__server__apis.html#ga097e8ed2f4933286ea5ef93210572b6b">XSecure_RsaInitialize()</a>, <a class="el" href="group__xsecure__rsa__client__apis.html#gaad026ed28e47be9b59e0444deb3af85a">XSecure_RsaPrivateDecrypt()</a>, and <a class="el" href="group__xsecure__rsa__client__apis.html#gaf2a6250efae11b0bdbfe22e6642dedf4">XSecure_RsaPublicEncrypt()</a>.</p>

</div>
</div>
<a class="anchor" id="a8cf65db24d617af02144836f17aaacab"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">u32 XSecure_SecureImage </td>
          <td>(</td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>AddrHigh</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>AddrLow</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>KupAddrHigh</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>KupAddrLow</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">XSecure_DataAddr *&#160;</td>
          <td class="paramname"><em>Addr</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function process the secure image of single partition created by bootgen. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">AddrHigh</td><td>Higher 32-bit linear memory space of single partition non-bitstream image. </td></tr>
    <tr><td class="paramname">AddrLow</td><td>Lower 32-bit linear memory space of single partition non-bitstream image. </td></tr>
    <tr><td class="paramname">KupAddrHigh</td><td>Higher 32-bit linear memory space of KUP key. </td></tr>
    <tr><td class="paramname">KupAddrLow</td><td>Ligher 32-bit linear memory space of KUP key. </td></tr>
    <tr><td class="paramname">Addr</td><td>Location of the secure image loaded after validation.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Returns Status<ul>
<li>XST_SUCCESS on success</li>
<li>Error code on failure </li>
</ul>
</dd></dl>

<p>References <a class="el" href="xsecure_8h.html#aa68197df399a72a69c10f58cb3a3de79">XSECURE_AUTH_CERT_MIN_SIZE</a>, <a class="el" href="xsecure_8h.html#ad49a6c04f8c5d2f0323c471c54170614">XSECURE_AUTH_NOT_ENABLED</a>, <a class="el" href="xsecure_8c.html#a8edc4da56d93ab6df2072aa149d79344">XSecure_AuthenticationHeaders()</a>, <a class="el" href="xsecure_8h.html#aac2297f42fbafe37616330961ab4c36a">XSECURE_BUFFER_SIZE</a>, <a class="el" href="xsecure_8c.html#a4fd45abb6cdf3c35aa46792bf312dbed">XSecure_CsuDmaInit()</a>, <a class="el" href="xsecure_8h.html#a8fc327ff9798f63989b9d3bd4e0eee6f">XSECURE_DEC_WRONG_KEY_SOURCE</a>, <a class="el" href="xsecure_8h.html#a1c99be6a6b095d43fcf926f491c10048">XSECURE_ENC_ISCOMPULSORY</a>, <a class="el" href="xsecure_8h.html#a46aedd95d7c6d65e8988a644e44321d1">XSECURE_ERROR_CSUDMA_INIT_FAIL</a>, <a class="el" href="xsecure_8h.html#a0e16fb7f7382f6f51dee31b68f30c6a1">XSECURE_HDR_NOAUTH_PART_AUTH</a>, <a class="el" href="xsecure_8c.html#a23dad33b2fa4200a33342e8353b7b73f">XSecure_IsEncOnlyEnabled()</a>, <a class="el" href="xsecure_8h.html#ad9f00b96d7039b8096a1239cf072520d">XSECURE_ISNOT_SECURE_IMAGE</a>, <a class="el" href="xsecure_8h.html#ad18affbc479b51e1a7de3221187f2297">XSECURE_IV_LEN</a>, <a class="el" href="xsecure_8h.html#a66458ce27949f2f92e6f622d6303221c">XSECURE_IV_OFFSET</a>, <a class="el" href="xsecure_8h.html#a9c8ada760210d274cef925099e1d6f6b">XSECURE_KEY_SOURCE_OFFSET</a>, <a class="el" href="xsecure_8h.html#a8c08e67e8de455fa33137880aac4c942">XSECURE_KEY_SRC_BBRAM</a>, <a class="el" href="xsecure_8h.html#a380a712ef28e82d96df301ebe45b2415">XSECURE_KEY_SRC_BLACK_BH</a>, <a class="el" href="xsecure_8h.html#a4ca380bbff8982b378c132fa8dee709d">XSECURE_KEY_SRC_GREY_BH</a>, <a class="el" href="xsecure_8h.html#adc4a927cf74a9756bbaa10b3c37ddd99">XSECURE_KEY_SRC_KUP</a>, <a class="el" href="xsecure_8c.html#a13ca99347b37b300de1c90e694fd116b">XSecure_MemCopy()</a>, <a class="el" href="xsecure_8h.html#affa5eab1b136afaf4581f32de7e30b3d">XSECURE_PARTITION_FAIL</a>, <a class="el" href="xsecure_8c.html#a54a754b03bfbbe9c42f9f3d10959f04e">XSecure_PartitionAuthentication()</a>, <a class="el" href="xsecure_8h.html#ace2b92ceadf36898ececf31c259983d8">XSECURE_PH_ATTR_AUTH_ENABLE</a>, <a class="el" href="xsecure_8h.html#ab76efd768465162bf06332794e75fe8f">XSECURE_PH_ATTR_ENC_ENABLE</a>, <a class="el" href="xsecure_8h.html#a94c8b9c73cb71a12aaf41e1a4a365f82">XSECURE_PH_IV_MASK</a>, <a class="el" href="xsecure_8h.html#ae91268580ada98ce004dd804a53043a3">XSECURE_PH_TABLE_OFFSET</a>, <a class="el" href="xsecure_8h.html#aa4871364f887e1c50336b5615ab2fc23">XSECURE_PPK_SIZE</a>, <a class="el" href="xsecure_8c.html#a65d3059c55b42f10354592056c053610">XSecure_VerifySpk()</a>, <a class="el" href="group__xsecure__common__apis.html#ga09ac633955bf536ddd22f13805791a2e">XSECURE_WORD_LEN</a>, and <a class="el" href="xsecure_8h.html#a215ede8f5e0e93b5120cbf9ceed3a969">XSECURE_WORD_SHIFT</a>.</p>

</div>
</div>
<a class="anchor" id="adfb02b0d0129acbfe8a8d6a293a7285f"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">u32 XSecure_Sha3Hash </td>
          <td>(</td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>SrcAddrHigh</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>SrcAddrLow</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>SrcSize</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>Flags</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function access the xilsecure SHA3 hardware based on the flags provided to calculate the SHA3 hash. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">SrcAddrHigh</td><td>Higher 32-bit of the input or output address. </td></tr>
    <tr><td class="paramname">SrcAddrLow</td><td>Lower 32-bit of the input or output address. </td></tr>
    <tr><td class="paramname">SrcSize</td><td>Size of the data on which hash should be calculated. </td></tr>
    <tr><td class="paramname">Flags,:</td><td>inputs for the operation requested BIT(0) - for initializing csudma driver and SHA3, (Here address and size inputs can be NULL) BIT(1) - To call Sha3_Update API which can be called multiple times when data is not contiguous. BIT(2) - to get final hash of the whole updated data. Hash will be overwritten at provided address with 48 bytes.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Returns Status XST_SUCCESS on success and error code on failure. </dd></dl>

<p>References <a class="el" href="xsecure_8c.html#a4fd45abb6cdf3c35aa46792bf312dbed">XSecure_CsuDmaInit()</a>, <a class="el" href="xsecure_8h.html#a46aedd95d7c6d65e8988a644e44321d1">XSECURE_ERROR_CSUDMA_INIT_FAIL</a>, <a class="el" href="xsecure_8h.html#aa03f86ffde3ba23e16caebaa5d79505f">XSECURE_INVALID_FLAG</a>, <a class="el" href="xsecure_8h.html#a0a83012828f023904268bb8a9a8587a9">XSECURE_SHA3_FINAL</a>, <a class="el" href="xsecure_8h.html#a41a11ab3a55f8be66a7ab4c0f4b71ffa">XSECURE_SHA3_INIT</a>, <a class="el" href="xsecure_8h.html#a3d0210f9d8d77369512f525b74c7fb3e">XSECURE_SHA3_INIT_FAIL</a>, <a class="el" href="xsecure_8h.html#a8af937a1b0ea302fb69cf68200b073fb">XSECURE_SHA3_MASK</a>, <a class="el" href="xsecure_8h.html#a0cc5123680fec2fcfcbfa45d1fbc658a">XSECURE_SHA3_UPDATE_FAIL</a>, <a class="el" href="group__xsecure__sha__client__apis.html#gad9611876471310e83eae5fc2ac640576">XSecure_Sha3Finish()</a>, <a class="el" href="xsecure_8h.html#ada6d1aff0fa4736ef40ab1caf9399b64">XSECURE_SHA3HASH_UPDATE</a>, <a class="el" href="group__xsecure__sha__client__apis.html#gabf91e298c2be913258c6a4b23660a528">XSecure_Sha3Initialize()</a>, <a class="el" href="group__xsecure__sha3__zynqmp__apis.html#gaf5b5bd6216ac55a6a9baf719e6bdd725">XSecure_Sha3Start()</a>, and <a class="el" href="group__xsecure__sha__client__apis.html#ga66d0db1bbf860bc2247297ce63f398a2">XSecure_Sha3Update()</a>.</p>

<p>Referenced by <a class="el" href="group__xsecure__hmac__apis.html#ga19b58a827d01b838233e4b98fb95b0f7">XSecure_HmacFinal()</a>, and <a class="el" href="group__xsecure__kat__server__apis.html#ga56962fc3f5090340f69a4fa56ef264ad">XSecure_Sha3Kat()</a>.</p>

</div>
</div>
<a class="anchor" id="ae9ccb5dc051bf792ce88b8f3fe376122"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">u32 XSecure_SpkAuthentication </td>
          <td>(</td>
          <td class="paramtype">XCsuDma *&#160;</td>
          <td class="paramname"><em>CsuDmaInstPtr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u8 *&#160;</td>
          <td class="paramname"><em>AuthCert</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u8 *&#160;</td>
          <td class="paramname"><em>Ppk</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function authenticates SPK with provided PPK or PPK from authentication certificate. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">CsuDmaInstPtr</td><td>Pointer to CSU DMA instance. </td></tr>
    <tr><td class="paramname">AuthCert</td><td>Pointer to authentication certificate. </td></tr>
    <tr><td class="paramname">Ppk</td><td>Pointer to the PPK key.<ul>
<li>If NULL uses PPK from provided authentication certificate.</li>
</ul>
</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Returns Status<ul>
<li>XST_SUCCESS on successful verification.</li>
<li>Error code on failure. </li>
</ul>
</dd></dl>

<p>References <a class="el" href="xsecure_8h.html#ac943a32bee0688b045c000358566b02a">XSECURE_AH_ATTR_SPK_ID_FUSE_SEL_MASK</a>, <a class="el" href="xsecure_8h.html#ab97e0bbcb1e1f94960d7b73953c8bb5d">XSECURE_AH_ATTR_SPKID_FUSESEL_SHIFT</a>, <a class="el" href="xsecure_8h.html#ad5ac2349763ed965ea5a59f2e7abf605">XSECURE_AUTH_HEADER_SIZE</a>, <a class="el" href="group__xsecure__rsa__server__apis.html#gae3637356df5720621bbd9924fa45a8d8">XSECURE_HASH_TYPE_SHA3</a>, <a class="el" href="xsecure_8h.html#a55bd16ac39be10e831ded7a34e18b2ee">XSECURE_INVALID_EFUSE_SELECT</a>, <a class="el" href="xsecure_8h.html#aabff310022b9324c4c77765deb6de570">XSECURE_PPK_MOD_EXT_SIZE</a>, <a class="el" href="xsecure_8h.html#aad4184d3a0cafce4e289b19e97c25497">XSECURE_PPK_MOD_SIZE</a>, <a class="el" href="xsecure_8h.html#aa4871364f887e1c50336b5615ab2fc23">XSECURE_PPK_SIZE</a>, <a class="el" href="xsecure_8h.html#ab14d7c85b25ee828619a5b204d2dde07">XSECURE_RSA_AC_ALIGN</a>, <a class="el" href="xsecure_8h.html#a9595b282fd35df1381678970068884b6">XSECURE_RSA_ENCRYPT_ERR</a>, <a class="el" href="xsecure_8h.html#aaf585eb3f73504822eebdad3cf3e2d52">XSECURE_RSA_INIT_ERR</a>, <a class="el" href="group__xsecure__rsa__server__apis.html#ga097e8ed2f4933286ea5ef93210572b6b">XSecure_RsaInitialize()</a>, <a class="el" href="group__xsecure__rsa__client__apis.html#gaf2a6250efae11b0bdbfe22e6642dedf4">XSecure_RsaPublicEncrypt()</a>, <a class="el" href="group__xsecure__rsa__client__apis.html#ga8bdc7108615c89806dae54dd56f428d7">XSecure_RsaSignVerification()</a>, <a class="el" href="xsecure_8h.html#a3d0210f9d8d77369512f525b74c7fb3e">XSECURE_SHA3_INIT_FAIL</a>, <a class="el" href="group__xsecure__sha__client__apis.html#gad9611876471310e83eae5fc2ac640576">XSecure_Sha3Finish()</a>, <a class="el" href="group__xsecure__sha__client__apis.html#gabf91e298c2be913258c6a4b23660a528">XSecure_Sha3Initialize()</a>, <a class="el" href="group__xsecure__sha3__zynqmp__apis.html#ga2e99ff8e049c773e83e4568f73cc92c1">XSecure_Sha3PadSelection()</a>, <a class="el" href="group__xsecure__sha3__zynqmp__apis.html#gaf5b5bd6216ac55a6a9baf719e6bdd725">XSecure_Sha3Start()</a>, <a class="el" href="group__xsecure__sha__client__apis.html#ga66d0db1bbf860bc2247297ce63f398a2">XSecure_Sha3Update()</a>, <a class="el" href="xsecure_8h.html#a7e3eb4e7d168365bee3b4f46c9a883dd">XSECURE_SPK_ERR</a>, <a class="el" href="xsecure_8h.html#a9708bbba8cf2f6e053e93a022f7117da">XSECURE_SPK_SIG_SIZE</a>, <a class="el" href="xsecure_8h.html#a01d51838b919ad92a559fd7b7ab2b35d">XSECURE_SPK_SIZE</a>, <a class="el" href="xsecure_8h.html#ae45390b22ac9391c5ed89ec8de0dc345">XSECURE_SPKID_EFUSE</a>, <a class="el" href="xsecure_8h.html#a5d075fa45db8f19df86efdb173bd6f74">XSECURE_USER_EFUSE</a>, and <a class="el" href="xsecure_8h.html#a06fd479d4a9d395e469decc2a6158ce2">XSECURE_VERIFY_ERR</a>.</p>

<p>Referenced by <a class="el" href="xsecure_8h.html#a65d3059c55b42f10354592056c053610">XSecure_VerifySpk()</a>.</p>

</div>
</div>
<a class="anchor" id="a39d709813a6f7eb25f5ecd0871d05615"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">u32 XSecure_SpkRevokeCheck </td>
          <td>(</td>
          <td class="paramtype">u8 *&#160;</td>
          <td class="paramname"><em>AuthCert</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function checks whether SPK is been revoked or not. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">AuthCert</td><td>Pointer to authentication certificate.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Returns Status<ul>
<li>XST_SUCCESS on successful verification.</li>
<li>Error code on failure. </li>
</ul>
</dd></dl>

<p>References <a class="el" href="xsecure_8h.html#afc2aaa9cb99b1fcecd7ea7f82df6d5c9">XSECURE_AC_SPKID_OFFSET</a>, <a class="el" href="xsecure_8h.html#ac943a32bee0688b045c000358566b02a">XSECURE_AH_ATTR_SPK_ID_FUSE_SEL_MASK</a>, <a class="el" href="xsecure_8h.html#ab97e0bbcb1e1f94960d7b73953c8bb5d">XSECURE_AH_ATTR_SPKID_FUSESEL_SHIFT</a>, <a class="el" href="xsecure_8h.html#ab565b659d0371ec487ceb9f1262f1fd0">XSECURE_EFUSE_SPKID</a>, <a class="el" href="xsecure_8h.html#a55bd16ac39be10e831ded7a34e18b2ee">XSECURE_INVALID_EFUSE_SELECT</a>, <a class="el" href="xsecure_8h.html#af9c900a33ba334700feb0e72747bc819">XSECURE_OUT_OF_RANGE_USER_EFUSE_ERROR</a>, <a class="el" href="xsecure_8h.html#a6c3477ad221eecc12c2a5c185c6ebf85">XSECURE_REVOKE_ERR</a>, <a class="el" href="xsecure_8h.html#a7e3eb4e7d168365bee3b4f46c9a883dd">XSECURE_SPK_ERR</a>, <a class="el" href="xsecure_8h.html#ae45390b22ac9391c5ed89ec8de0dc345">XSECURE_SPKID_EFUSE</a>, <a class="el" href="xsecure_8h.html#a5d075fa45db8f19df86efdb173bd6f74">XSECURE_USER_EFUSE</a>, <a class="el" href="xsecure_8h.html#a204157fd0ffbd25a2ffd3eebad78704d">XSECURE_USER_EFUSE_MAX_VALUE</a>, <a class="el" href="xsecure_8h.html#ad191be68bd257eedcd09685304651b56">XSECURE_USER_EFUSE_MIN_VALUE</a>, <a class="el" href="xsecure_8h.html#a2c3a237cc783f65a3f582595777fd967">XSECURE_USER_EFUSE_START_ADDR</a>, <a class="el" href="group__xsecure__common__apis.html#ga09ac633955bf536ddd22f13805791a2e">XSECURE_WORD_LEN</a>, and <a class="el" href="xsecure_8h.html#a215ede8f5e0e93b5120cbf9ceed3a969">XSECURE_WORD_SHIFT</a>.</p>

<p>Referenced by <a class="el" href="xsecure_8h.html#a65d3059c55b42f10354592056c053610">XSecure_VerifySpk()</a>.</p>

</div>
</div>
<a class="anchor" id="a65d3059c55b42f10354592056c053610"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">u32 XSecure_VerifySpk </td>
          <td>(</td>
          <td class="paramtype">u8 *&#160;</td>
          <td class="paramname"><em>AcPtr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>EfuseRsaenable</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function verifies SPK by authenticating SPK with PPK, also checks either SPK is revoked or not.if it is not boot header authentication. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">AcPtr</td><td>Pointer to the authentication certificate. </td></tr>
    <tr><td class="paramname">EfuseRsaenable</td><td>Input variable which holds efuse RSA authentication or boot header authentication. 0 - Boot header authentication 1 - RSA authentication</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Returns Status<ul>
<li>XST_SUCCESS on success</li>
<li>Error code on failure </li>
</ul>
</dd></dl>

<p>References <a class="el" href="xsecure_8c.html#af673d8443678e45f3334378a4b446881">XSecure_IsRsaEnabled()</a>, <a class="el" href="xsecure_8c.html#ae9ccb5dc051bf792ce88b8f3fe376122">XSecure_SpkAuthentication()</a>, and <a class="el" href="xsecure_8c.html#a39d709813a6f7eb25f5ecd0871d05615">XSecure_SpkRevokeCheck()</a>.</p>

<p>Referenced by <a class="el" href="xsecure_8h.html#a8cf65db24d617af02144836f17aaacab">XSecure_SecureImage()</a>.</p>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
	<p class="footer">&copy; Copyright 2015-2022 Xilinx, Inc. All Rights Reserved.</p>
	<p class="footer">&copy; Copyright 2022-2023 Advanced Micro Devices, Inc. All Rights Reserved.</p>
</div>
</body>
</html>
